package abc;
import java.io.*;
import java.net.*;
import java.nio.charset.MalformedInputException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class beauty {
    public static void main(String[]args){
        URL url=null;
        URLConnection urlConnection=null;
        BufferedReader br=null;
        PrintWriter pw=null;
        try{
            url=new URL("https://image.baidu.com/search/index?tn=baiduimage&ps=1&ct=201326592&lm=-1&cl=2&nc=1&ie=utf-8&dyTabStr=MCwzLDEsNiw0LDUsMiw3LDgsOQ%3D%3D&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87");
            urlConnection=url.openConnection();
            pw=new PrintWriter(new FileWriter("D:/NB.txt"),true);
            System.out.println("Stay here1!!");
            br=new BufferedReader(new InputStreamReader(urlConnection.getInputStream(),"Utf-8"));
            String buf=null;
            System.out.println("Stay here2!!");
            Pattern p=Pattern.compile("1\\d{10}");
            while((buf=br.readLine())!=null){
                System.out.println(buf);
                Matcher m=p.matcher(buf);
                while(m.find()){
                    pw.println(m.group());
                }
            }
            System.out.println("Success!");
        } catch(IOException e){
            e.printStackTrace();
        }
    }
}
